set(LibSampleApp_SOURCES)
list(APPEND LibSampleApp_SOURCES
    CaptionPresenter.cpp
    ConnectionObserver.cpp
    ConsolePrinter.cpp
    ConsoleReader.cpp
    ExternalCapabilitiesBuilder.cpp
    GuiRenderer.cpp
    InteractionManager.cpp
    KeywordObserver.cpp
    LocaleAssetsManager.cpp
    UserInputManager.cpp
    UIManager.cpp
    SampleApplicationComponent.cpp
    SampleApplication.cpp
    SampleEqualizerModeController.cpp
    main.cpp)

if (DIAGNOSTICS)
    list(APPEND LibSampleApp_SOURCES SDKDiagnostics.cpp)
endif()

if (PORTAUDIO)
    list(APPEND LibSampleApp_SOURCES PortAudioMicrophoneWrapper.cpp)
endif()

IF (A4B)
    list(APPEND LibSampleApp_SOURCES RevokeAuthorizationObserver.cpp)
ENDIF()

if (PCC)
    list(APPEND LibSampleApp_SOURCES PhoneCaller.cpp)
endif()

if (MCC)
    list(APPEND LibSampleApp_SOURCES MeetingClient.cpp)
    list(APPEND LibSampleApp_SOURCES CalendarClient.cpp)
endif()

if (ENDPOINT_CONTROLLERS_POWER_CONTROLLER OR ENDPOINT_CONTROLLERS_TOGGLE_CONTROLLER OR 
        ENDPOINT_CONTROLLERS_RANGE_CONTROLLER OR ENDPOINT_CONTROLLERS_MODE_CONTROLLER)
    add_definitions(-DENABLE_ENDPOINT_CONTROLLERS)
endif()

if (ENDPOINT_CONTROLLERS_POWER_CONTROLLER)
    list(APPEND LibSampleApp_SOURCES PeripheralEndpoint/PeripheralEndpointPowerControllerHandler.cpp)
endif()

if (ENDPOINT_CONTROLLERS_TOGGLE_CONTROLLER)
    list(APPEND LibSampleApp_SOURCES PeripheralEndpoint/PeripheralEndpointToggleControllerHandler.cpp)
    list(APPEND LibSampleApp_SOURCES DefaultEndpoint/DefaultEndpointToggleControllerHandler.cpp)

endif()

if (ENDPOINT_CONTROLLERS_RANGE_CONTROLLER)
    list(APPEND LibSampleApp_SOURCES PeripheralEndpoint/PeripheralEndpointRangeControllerHandler.cpp)
    list(APPEND LibSampleApp_SOURCES DefaultEndpoint/DefaultEndpointRangeControllerHandler.cpp)
endif()

if (ENDPOINT_CONTROLLERS_MODE_CONTROLLER)
    list(APPEND LibSampleApp_SOURCES PeripheralEndpoint/PeripheralEndpointModeControllerHandler.cpp)
    list(APPEND LibSampleApp_SOURCES DefaultEndpoint/DefaultEndpointModeControllerHandler.cpp)
endif()

# Generated by add_external_media_player_adapters
list(APPEND LibSampleApp_SOURCES ${ALL_EMP_ADAPTER_REGISTRATION_FILES})

add_library(LibSampleApp STATIC ${LibSampleApp_SOURCES})

target_include_directories(LibSampleApp PUBLIC
    # This is relative to project(SampleApp).
    "${SampleApp_SOURCE_DIR}/include"
    "${AudioResources_SOURCE_DIR}/include"
    "${RegistrationManager_SOURCE_DIR}/include"
    "${ESP_SOURCE_DIR}/include"
    "${InterruptModel_SOURCE_DIR}/config"
    "${PORTAUDIO_INCLUDE_DIR}")

target_link_libraries(LibSampleApp
    acsdkCore
    acsdkManufactory
    DefaultClient
    AVSCommon
    AVSGatewayManager
    CapabilitiesDelegate
    CBLAuthDelegate
    SQLiteStorage
    SynchronizeStateSender
    EqualizerImplementations
    InterruptModel
    "${PORTAUDIO_LIB_PATH}")

if (ACS_UTILS)
    target_link_libraries(LibSampleApp acsdkACSSampleApplicationOptions)
else()
    target_link_libraries(LibSampleApp acsdkDefaultSampleApplicationOptions)
endif()

if (PCC)
    target_link_libraries(LibSampleApp AVSCommon)
endif()

if (MCC)
    target_link_libraries(LibSampleApp AVSCommon)
endif()

if (ANDROID)
    target_include_directories(LibSampleApp PUBLIC "${AndroidUtilities}/include")
    target_link_libraries(LibSampleApp AndroidUtilities)
    if (ANDROID_MEDIA_PLAYER)
        target_include_directories(LibSampleApp PUBLIC "${AndroidSLESMediaPlayer}/include")
        target_link_libraries(LibSampleApp AndroidSLESMediaPlayer)
    endif()
endif()

if (GSTREAMER_MEDIA_PLAYER)
    target_include_directories(LibSampleApp PUBLIC "${MediaPlayer_SOURCE_DIR}/include")
    target_link_libraries(LibSampleApp MediaPlayer)
elseif (CUSTOM_MEDIA_PLAYER)
    target_link_libraries(LibSampleApp ${CUSTOM_MEDIA_PLAYER_TARGETS})
endif()

if(KWD)
    target_link_libraries(LibSampleApp KeywordDetectorProvider)
endif()

if (COMMS)
    target_link_libraries(LibSampleApp CallManager)
endif()

if (MRM AND MRM_STANDALONE_APP)
    target_link_libraries(LibSampleApp acsdkMultiRoomMusic MRMHandlerProxy)
elseif (MRM)
    target_link_libraries(LibSampleApp acsdkMultiRoomMusic MRMHandler)
endif()

if (DIAGNOSTICS)
    target_link_libraries(LibSampleApp Diagnostics)
endif()

if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
    target_link_libraries(LibSampleApp
        "-framework CoreAudio"
        "-framework AudioToolbox"
        "-framework AudioUnit"
        "-framework CoreServices"
        "-framework Carbon")
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
    target_link_libraries(LibSampleApp
      rt m pthread asound atomic)
endif()

add_executable(SampleApp
    main.cpp)

target_link_libraries(SampleApp LibSampleApp)

# install target
asdk_install_targets(LibSampleApp TRUE)
